LeavBillAuditFormWindow = Ext.extend(Ext.Window, {
    businessFormPanel : null,
    commentGridPanel : null,
    constructor : function(config) {
        Ext.applyIf(this, config);
        this.initUIComponents(config);
        LeavBillAuditFormWindow.superclass.constructor.call(this, {
            layout : "border",
            items : [ this.businessFormPanel, this.commentGridPanel ],
            modal : true,
            bodyStyle : "padding:2px;",
            buttonAlign : "center",
            title : "业务流程审核处理",
            iconCls : "menu-flowWait",
            width : 600,
            height : 500
        });
    },
    initUIComponents : function(config) {
        createyeargridform({
            operation:{id : config.businessId},
            form : {
                saveUrl : __ctxPath + "/bpmndemo/processNextStepLeaveBill.do",
                items : [ {
                    name : "businessId",
                    xtype : "hidden",
                    value : config.businessId
                }, {
                    name : "taskId",
                    xtype : "hidden",
                    value : config.taskId
                }, {
                    name : "instanceId",
                    xtype : "hidden",
                    value : config.instanceId
                },{
                    name : "leaveBill.name",
                    xtype : "textfield",
                    disabled :true,
                    fieldLabel : '请假人',
                },  {
                    name : "leaveBill.days",
                    xtype : "textfield",
                    disabled :true,
                    fieldLabel : '请假天数',
                }, {
                    fieldLabel : '请假原因' + '<font color=red>*</font>',
                    name : "leaveBill.reason",
                    maxLength : 80,
                    disabled :true,
                    xtype : "textarea",
                    width : 300
                },{
                    layout : "column", // 第一行
                    bodyStyle : "padding:5px;",
                    items : [ {
                        columnWidth : .5,// 第一行第1列
                        border : false,                       
                        items : [ {
                            xtype : "button",
                            hidden : this.isShow==true?true:false,
                            style : "padding-left:100px",
                            text : "通过",
                            handler : LeavBillAuditFormWindow.tongguo.createCallback(config.refreshGridId)
                        } ]
                    },{
                        columnWidth : .5,// 第一行第1列
                        border : false,
                        items : [ {
                            xtype:"button",
                            hidden : this.isShow==true?true:false,
                            text : "驳回",                           
                            handler : LeavBillAuditFormWindow.bohui.createCallback(config.refreshGridId)
                        } ]
                    } ]
                },{
                    fieldLabel : '批注',
                    name : "comment",
                    maxLength : 80,
                    readOnly : this.isShow==true?true:false,
                    xtype : "textarea",
                    width : 300
                } ]

            },
            loadData : {
                getUrl : __ctxPath + "/bpmndemo/getLeaveBill.do",
                preName : "leaveBill"
            },
            // 配置项意为双击打开后的form为只读
            isShow : this.isShow
        });

        var commentGrid = new creategridview({
            topbar : {
                inputFormName : 'LeaveBillManagerForm',
                hidden : true,
                topbarAdd : {
                    hidden : true
                },
                topbarDel : {
                    hidden : true
                }
            },
            search : {
                items : []
            },
            grid : {
                title : "请假申请历史批注信息列表",
                rowdblclick : true,
                listUrl : __ctxPath + "/bpmndemo/listCommentWorkflow.do?processInstanceId=" + this.instanceId,
                fields : [ "id", 'time', 'userId', 'fullMessage' ],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "时间",
                    dataIndex : "time",
                    width : 70
                }, {
                    header : "批注人",
                    dataIndex : "userId",
                    width : 50
                }, {
                    header : "批注信息",
                    dataIndex : "fullMessage",
                    width : 70
                } ]

            }
        });
        this.businessFormPanel = new Ext.Panel({
            region : "north",
            bodyStyle : "padding:2px;",
            title : "业务信息概要",
            layout : "fit",
            width : 600,
            height : 280,
            items : yearGridFormPanel
        })

        this.commentGridPanel = new Ext.Panel({
            region : "center",
            bodyStyle : "padding:2px;",
            layout : "fit",
            width : 600,
            height : 200,
            items : commentGrid.yearGridPanel
        })
    }

});
LeavBillAuditFormWindow.tongguo=function(refreshGridId){
    if (yearGridFormPanel.getForm().isValid()){
        yearGridFormPanel.getForm().submit({
            method : "post",
            params: {
                message:"pass" 
            },
            scope:this,
            waitMsg : "正在提交数据...",
            success : function(e, f) {
                Ext.ux.Toast.msg("操作提示", "办理成功！");
                Ext.getCmp(refreshGridId).getStore().reload();
                yearGridFormPanel.ownerCt.ownerCt.close();
            },
            failure : function(e, f) {
                Ext.MessageBox.show({
                    title : "操作提示",
                    msg : f.result.msg=null?"信息保存出错，请联系管理员！":f.result.msg,
                    buttons : Ext.MessageBox.OK,
                    icon : "ext-mb-error"
                });
               
            }
        });
    }
    
}
LeavBillAuditFormWindow.bohui=function(refreshGridId){
    if (yearGridFormPanel.getForm().isValid()){
        yearGridFormPanel.getForm().submit({
            method : "post",
            params: {
                message:"back" 
            },
            scope:this,
            waitMsg : "正在提交数据...",
            success : function(e, f) {
                Ext.ux.Toast.msg("操作提示", "办理成功！");
                Ext.getCmp(refreshGridId).getStore().reload();
                yearGridFormPanel.ownerCt.ownerCt.close();
            },
            failure : function(e, f) {
                Ext.MessageBox.show({
                    title : "操作提示",
                    msg : f.result.msg=null?"信息保存出错，请联系管理员！":f.result.msg,
                    buttons : Ext.MessageBox.OK,
                    icon : "ext-mb-error"
                });
               
            }
        });
    }
}